<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
//数组
    //数组的创建
    let array0 = new Array();
    console.log(typeof(array0));    //object
    let array1 = new Array(1,2.2,-3,"HELLO");
    let array2 = [1,2,3];
    let array3 = [];
    console.log(array0);
    console.log(array1);
    console.log(array2);
    console.log(array2[0]); //1
    console.log(array2[100]); //越界则：undefined
    //新增元素
        //1.
        array2.length = 10;
        array2[8] = 9;
        console.log(array2);
        //2.
        array2[20] = 20;
        console.log(array2);
        //3.
        let new_array = new Array();
        for(let i = 0;i<array1.length;i++)
        {
            new_array.push(array1[i]);
        }
        console.log(new_array);
    //删除元素
        new_array.splice(1,1);  //从第i个位置开始删除j个元素
        console.log(new_array);

</script>
</html>